home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 347 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. From: "john (j.d.) hickin" <hickin@bnr.ca>
  2. Message-ID: <4ffq10$7vb@bmtlh10.bnr.ca>
  3. X-Original-Date: Fri, 9 Feb 1996 15:42:24 +0000
  4. Path: in1.uu.net!bounce-back
  5. Date: 10 Feb 96 08:35:39 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Return-Path: <daemon@meeker.UCAR.EDU>
  8. References: <GNB.96Feb7140952@dame.bby.com.au>
  9. Subject: Re: proposal: renew & relocator member fn
  10. Newsgroups: comp.std.c++
  11. Organization: Bell-Northern Research
  12. X-Mailer: Mozilla 1.1 (X11; I; HP-UX A.09.05 9000/715) 
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBFAgUBMRxZIOEDnX0m9pzZAQG+LwF/S3HU0BrOOOhBNEQINW1P+bwKAafP2Tzs
  15.     gOIjXZkM6oSJsKS63+3KhvfOKYqZUScR
  16.     =++JQ
  17.  
  18. |> Go ahead, shoot me down!
  19.  
  20. POW!
  21.  
  22. Seriously, how can the compiler tell when deep-copy is or isn't needed.  You
  23. can help it, however, by using auto_ptr for the 'external' parts of an object
  24. (i.e., those logically part of it but included through a pointer; this term is
  25. my own so don't expect others to use it; I am looking for a better term). 
  26.  
  27. With auto_ptr's in place your relocate operation is a breeze -- just copy the
  28. object with a copy constructor and placement new.
  29.  
  30. This seems to be an ideal application for certain semantics of auto_ptr that
  31. have been considered to be offensive.  To be maximally const-correct your
  32. class will need a non-const copy constructor.
  33.  
  34. -- 
  35. John Hickin      Nortel Technology, Montreal, Quebec
  36. (514) 765-7924   hickin@bnr.ca
  37. ---
  38. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  39.   Contact address: std-c++-request@ncar.ucar.edu.  Moderation policy:
  40.   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  41.